package com.skin;

import java.io.InputStream;

import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.content.res.XmlResourceParser;
import android.graphics.Movie;
import android.graphics.drawable.Drawable;
import android.util.TypedValue;

public class Skin {
	Resources defRes;
	Resources skinRes;

	Skin(Context context, Resources res) {
		defRes = context.getResources();
		skinRes = res;
	}

	public XmlResourceParser getLayout(int id) {
		try {
			return skinRes.getLayout(id);
		} catch (NotFoundException ex) {
			return defRes.getLayout(id);
		}
	}

	public XmlResourceParser getXml(int id) {
		try {
			return skinRes.getXml(id);
		} catch (NotFoundException ex) {
			return defRes.getXml(id);
		}
	}

	public XmlResourceParser getAnimation(int id) {
		try {
			return skinRes.getAnimation(id);
		} catch (NotFoundException ex) {
			return defRes.getAnimation(id);
		}
	}

	public boolean getBoolean(int id) {
		try {
			return skinRes.getBoolean(id);
		} catch (NotFoundException ex) {
			return defRes.getBoolean(id);
		}
	}

	public int getInteger(int id) {
		try {
			return skinRes.getInteger(id);
		} catch (NotFoundException ex) {
			return defRes.getInteger(id);
		}
	}

	public int getColor(int id) {
		try {
			return skinRes.getColor(id);
		} catch (NotFoundException ex) {
			return defRes.getColor(id);
		}
	}

	public float getDimension(int id) {
		try {
			return skinRes.getDimension(id);
		} catch (NotFoundException ex) {
			return defRes.getDimension(id);
		}
	}

	public String getString(int id) {
		try {
			return skinRes.getString(id);
		} catch (NotFoundException ex) {
			return defRes.getString(id);
		}
	}

	public String getString(int id, Object... formatArgs) {
		try {
			return skinRes.getString(id, formatArgs);
		} catch (NotFoundException ex) {
			return defRes.getString(id, formatArgs);
		}
	}

	public Drawable getDrawable(int id) {
		try {
			return skinRes.getDrawable(id);
		} catch (NotFoundException ex) {
			return defRes.getDrawable(id);
		}
	}

	public Movie getMovie(int id) {
		try {
			return skinRes.getMovie(id);
		} catch (NotFoundException ex) {
			return defRes.getMovie(id);
		}
	}

	public InputStream openRawResource(int id) {
		try {
			return skinRes.openRawResource(id);
		} catch (NotFoundException ex) {
			return defRes.openRawResource(id);
		}
	}

	public InputStream openRawResource(int id, TypedValue value) {
		try {
			return skinRes.openRawResource(id, value);
		} catch (NotFoundException ex) {
			return defRes.openRawResource(id, value);
		}
	}

	public AssetFileDescriptor openRawResourceFd(int id) {
		try {
			return skinRes.openRawResourceFd(id);
		} catch (NotFoundException ex) {
			return defRes.openRawResourceFd(id);
		}
	}
}
